<template>
  <div
    :class="{ 'input-label--has-error': hasError }"
    class="input-label">
    <div
      :class="{ 'input-label__label--not-required': notRequired }"
      class="input-label__label">{{ label }}</div>
    <slot/>
  </div>
</template>

<style lang="scss" scoped>
  .input-label {
    display: flex;
    background-color: #fff;
    border: 2px solid transparent;
    &--has-error {
      border: 2px solid #E73535;
    }
    &__label {
      width: 140px;
      flex-shrink: 0;
      height: 120px;
      font-size: 28px;
      display: flex;
      align-items: center;
      position: relative;
      color: #343434;
      padding: 0 16px;
      &::after {
        content: '*';
        font-size: 28px;
        color: #F30808;
        margin-left: 8px;
      }
      &::before {
        content: '';
        display: block;
        width: 2px;
        height: 48px;
        background-color: #eee;
        position: absolute;
        right: 0;
      }

      &--not-required {
        &::after {
          content: '';
        }
      }
    }

    .input {
      flex: 1;
    }
  }
</style>

<script>
export default {
  props: {
    label: {
      type: String,
      default: ''
    },
    hasError: {
      type: Boolean,
      default: false
    },
    notRequired: {
      type: Boolean,
      default: false
    }
  }
}
</script>
